1、通过SPI,找到mpush-cache模块中CacheManagerFactory接口的实现类RedisCacheManagerFactory,得到RedisManager实例;
2、远程路由信息的添加、删除、获取;
3、订阅连接关闭事件ConnectionCloseEvent,将远程路由信息修改为离线(connId=null);
1 | public class RemoteRouterManager extends EventConsumer implements RouterManager<RemoteRouter> { |
RemoteRouter.java1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24public final class RemoteRouter implements Router<ClientLocation> {
private final ClientLocation clientLocation;
public RemoteRouter(ClientLocation clientLocation) {
this.clientLocation = clientLocation;
}
public boolean isOnline(){
return clientLocation.isOnline();
}
public boolean isOffline(){
return clientLocation.isOffline();
}
public ClientLocation getRouteValue() {
return clientLocation;
}
public RouterType getRouteType() {
return RouterType.REMOTE;
}
public String toString() {
return "RemoteRouter{" + clientLocation + '}';
}
}